package main_gui;

import calculation.FIRFrequenceSample;
import calculation.FIROptimalEquiripple;
import calculation.FIRWindow;
import java.awt.Desktop;
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JFileChooser;
import javax.swing.JList;
import javax.swing.JOptionPane;
import my_interface.FrequenceType;
import my_interface.SelectType;
import my_interface.WindowType;

/**
 *
 * @author KieuOanh
 */
public class FIRPanel extends javax.swing.JPanel implements WindowType, SelectType, FrequenceType {

    WindowFrame windowFrame;
    FIRWindow fIRWindow;
    //
    FrequenceFrame frequenceFrame;
    FIRFrequenceSample fIRFrequenceSample;
    //
    OptimalEquirippleFrame optimalEquirippleFrame;
    FIROptimalEquiripple fIROptimalEquiripple;
    //
    String[] ar21 = new String[]{"Rectangular"};
    String[] ar25 = new String[]{"Bartlett", "Kaiser"};
    String[] ar44 = new String[]{"Hanning", "Kaiser"};
    String[] ar53 = new String[]{"Hamming", "Kaiser"};
    String[] ar74 = new String[]{"Blackman", "Kaiser"};
    String[] ar7x = new String[]{"Kaiser"};
    //
    String source;

    /**
     * Creates new form FIRPanel
     */
    public FIRPanel() {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        initComponents();
        setVisible(true);
        jComboBoxFrequence.setVisible(false);
        jPanelLowpass.setVisible(true);
        jPanelBandpass.setVisible(false);
        jPanelHighpass.setVisible(false);
        jPanelBandstop.setVisible(false);
//        jPanelLowpass.setLocation(180, 100);
        setVisibleM(false);
        setVisibleT(false);
    }

    public void setVisibleM(boolean aFlag) {
        jLabelLowpassM.setVisible(aFlag);
        jLabelHighpassM.setVisible(aFlag);
        jLabelBandpassM.setVisible(aFlag);
        jLabelBandstopM.setVisible(aFlag);
        jTextFieldLowpassM.setVisible(aFlag);
        jTextFieldHighpassM.setVisible(aFlag);
        jTextFieldBandpassM.setVisible(aFlag);
        jTextFieldBandstopM.setVisible(aFlag);
    }

    public void setVisibleT(boolean aFlag) {
        jLabelLowpassT1.setVisible(aFlag);
        jLabelLowpassT2.setVisible(aFlag);
        jLabelHighpassT1.setVisible(aFlag);
        jLabelHighpassT2.setVisible(aFlag);
        jLabelBandpassT1.setVisible(aFlag);
        jLabelBandpassT2.setVisible(aFlag);
        jLabelBandstopT1.setVisible(aFlag);
        jLabelBandstopT2.setVisible(aFlag);
        jTextFieldLowpassT1.setVisible(aFlag);
        jTextFieldLowpassT2.setVisible(aFlag);
        jTextFieldHighpassT1.setVisible(aFlag);
        jTextFieldHighpassT2.setVisible(aFlag);
        jTextFieldBandpassT1.setVisible(aFlag);
        jTextFieldBandpassT2.setVisible(aFlag);
        jTextFieldBandstopT1.setVisible(aFlag);
        jTextFieldBandstopT2.setVisible(aFlag);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroupFIRType = new javax.swing.ButtonGroup();
        buttonGroupWindowMethod = new javax.swing.ButtonGroup();
        jPanelDesign = new javax.swing.JPanel();
        jRadioButtonWindow = new javax.swing.JRadioButton();
        jRadioButtonFrequence = new javax.swing.JRadioButton();
        jRadioButtonOptimal = new javax.swing.JRadioButton();
        jComboBoxWindow = new javax.swing.JComboBox();
        jComboBoxFrequence = new javax.swing.JComboBox();
        jPanelTypeSelect = new javax.swing.JPanel();
        jRadioButtonLowpass = new javax.swing.JRadioButton();
        jRadioButtonHighpass = new javax.swing.JRadioButton();
        jRadioButtonBandpass = new javax.swing.JRadioButton();
        jRadioButtonBandstop = new javax.swing.JRadioButton();
        jPanelLowpass = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jTextFieldLowpassWp = new javax.swing.JTextField();
        jTextFieldLowpassWs = new javax.swing.JTextField();
        jTextFieldLowpassRp = new javax.swing.JTextField();
        jTextFieldLowpassAs = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabelLowpassM = new javax.swing.JLabel();
        jTextFieldLowpassM = new javax.swing.JTextField();
        jLabelLowpassT1 = new javax.swing.JLabel();
        jTextFieldLowpassT1 = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        jLabel52 = new javax.swing.JLabel();
        jLabelLowpassT2 = new javax.swing.JLabel();
        jTextFieldLowpassT2 = new javax.swing.JTextField();
        jPanelHighpass = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jTextFieldHighpassWs = new javax.swing.JTextField();
        jTextFieldHighpassAs = new javax.swing.JTextField();
        jTextFieldHighpassWp = new javax.swing.JTextField();
        jTextFieldHighpassRp = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabelHighpassM = new javax.swing.JLabel();
        jTextFieldHighpassM = new javax.swing.JTextField();
        jLabelHighpassT1 = new javax.swing.JLabel();
        jTextFieldHighpassT1 = new javax.swing.JTextField();
        jLabelHighpassT2 = new javax.swing.JLabel();
        jTextFieldHighpassT2 = new javax.swing.JTextField();
        jPanelBandpass = new javax.swing.JPanel();
        jLabel20 = new javax.swing.JLabel();
        jTextFieldBandpassW1s = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jTextFieldBandpassAs = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jTextFieldBandpassW1p = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jTextFieldBandpassRp = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jTextFieldBandpassW2p = new javax.swing.JTextField();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jTextFieldBandpassW2s = new javax.swing.JTextField();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        jLabel36 = new javax.swing.JLabel();
        jLabel37 = new javax.swing.JLabel();
        jLabelBandpassM = new javax.swing.JLabel();
        jTextFieldBandpassM = new javax.swing.JTextField();
        jLabelBandpassT1 = new javax.swing.JLabel();
        jTextFieldBandpassT1 = new javax.swing.JTextField();
        jLabelBandpassT2 = new javax.swing.JLabel();
        jTextFieldBandpassT2 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jPanelBandstop = new javax.swing.JPanel();
        jLabel31 = new javax.swing.JLabel();
        jTextFieldBandstopW1s = new javax.swing.JTextField();
        jLabel35 = new javax.swing.JLabel();
        jLabel38 = new javax.swing.JLabel();
        jTextFieldBandstopAs = new javax.swing.JTextField();
        jLabel39 = new javax.swing.JLabel();
        jLabel40 = new javax.swing.JLabel();
        jTextFieldBandstopW2s = new javax.swing.JTextField();
        jLabel41 = new javax.swing.JLabel();
        jLabel42 = new javax.swing.JLabel();
        jTextFieldBandstopRp = new javax.swing.JTextField();
        jLabel43 = new javax.swing.JLabel();
        jLabel44 = new javax.swing.JLabel();
        jTextFieldBandstopW1p = new javax.swing.JTextField();
        jLabel45 = new javax.swing.JLabel();
        jLabel46 = new javax.swing.JLabel();
        jLabel47 = new javax.swing.JLabel();
        jTextFieldBandstopW2p = new javax.swing.JTextField();
        jLabel48 = new javax.swing.JLabel();
        jLabel49 = new javax.swing.JLabel();
        jLabel50 = new javax.swing.JLabel();
        jLabel51 = new javax.swing.JLabel();
        jLabelBandstopM = new javax.swing.JLabel();
        jTextFieldBandstopM = new javax.swing.JTextField();
        jLabelBandstopT1 = new javax.swing.JLabel();
        jTextFieldBandstopT1 = new javax.swing.JTextField();
        jLabelBandstopT2 = new javax.swing.JLabel();
        jTextFieldBandstopT2 = new javax.swing.JTextField();
        jLabel53 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();

        setName("");

        jPanelDesign.setBorder(javax.swing.BorderFactory.createTitledBorder("Design Techniques"));

        buttonGroupFIRType.add(jRadioButtonWindow);
        jRadioButtonWindow.setSelected(true);
        jRadioButtonWindow.setText("Window ");
        jRadioButtonWindow.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jRadioButtonWindowItemStateChanged(evt);
            }
        });

        buttonGroupFIRType.add(jRadioButtonFrequence);
        jRadioButtonFrequence.setText("Frequence Sampling ");
        jRadioButtonFrequence.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jRadioButtonFrequenceItemStateChanged(evt);
            }
        });

        buttonGroupFIRType.add(jRadioButtonOptimal);
        jRadioButtonOptimal.setText("Optimal Equiripple                                                        ");
        jRadioButtonOptimal.setToolTipText("");
        jRadioButtonOptimal.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jRadioButtonOptimalItemStateChanged(evt);
            }
        });

        jComboBoxWindow.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Rectangular", "Bartlett", "Hanning", "Hamming", "Blackman", "Kaiser" }));
        jComboBoxWindow.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jComboBoxWindowMousePressed(evt);
            }
        });
        jComboBoxWindow.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxWindowActionPerformed(evt);
            }
        });
        jComboBoxWindow.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jComboBoxWindowKeyPressed(evt);
            }
        });

        jComboBoxFrequence.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Naive design", "Optimum design" }));
        jComboBoxFrequence.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jComboBoxFrequenceMousePressed(evt);
            }
        });
        jComboBoxFrequence.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jComboBoxFrequenceItemStateChanged(evt);
            }
        });

        javax.swing.GroupLayout jPanelDesignLayout = new javax.swing.GroupLayout(jPanelDesign);
        jPanelDesign.setLayout(jPanelDesignLayout);
        jPanelDesignLayout.setHorizontalGroup(
            jPanelDesignLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelDesignLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelDesignLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanelDesignLayout.createSequentialGroup()
                        .addGroup(jPanelDesignLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jRadioButtonFrequence, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)
                            .addComponent(jRadioButtonWindow, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanelDesignLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelDesignLayout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jComboBoxFrequence, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanelDesignLayout.createSequentialGroup()
                                .addComponent(jComboBoxWindow, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))))
                    .addComponent(jRadioButtonOptimal, javax.swing.GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanelDesignLayout.setVerticalGroup(
            jPanelDesignLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelDesignLayout.createSequentialGroup()
                .addGroup(jPanelDesignLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButtonWindow, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxWindow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelDesignLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButtonFrequence, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxFrequence, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jRadioButtonOptimal, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(17, 17, 17))
        );

        jPanelTypeSelect.setBorder(javax.swing.BorderFactory.createTitledBorder("Type select"));

        buttonGroupWindowMethod.add(jRadioButtonLowpass);
        jRadioButtonLowpass.setSelected(true);
        jRadioButtonLowpass.setText("Lowpass ");
        jRadioButtonLowpass.setActionCommand("Low pass ");
        jRadioButtonLowpass.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jRadioButtonLowpassItemStateChanged(evt);
            }
        });
        jRadioButtonLowpass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonLowpassActionPerformed(evt);
            }
        });

        buttonGroupWindowMethod.add(jRadioButtonHighpass);
        jRadioButtonHighpass.setText("Highpass ");
        jRadioButtonHighpass.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jRadioButtonHighpassItemStateChanged(evt);
            }
        });
        jRadioButtonHighpass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonHighpassActionPerformed(evt);
            }
        });

        buttonGroupWindowMethod.add(jRadioButtonBandpass);
        jRadioButtonBandpass.setText("Bandpass");
        jRadioButtonBandpass.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jRadioButtonBandpassItemStateChanged(evt);
            }
        });
        jRadioButtonBandpass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonBandpassActionPerformed(evt);
            }
        });

        buttonGroupWindowMethod.add(jRadioButtonBandstop);
        jRadioButtonBandstop.setText("Bandstop ");
        jRadioButtonBandstop.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonBandstopActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelTypeSelectLayout = new javax.swing.GroupLayout(jPanelTypeSelect);
        jPanelTypeSelect.setLayout(jPanelTypeSelectLayout);
        jPanelTypeSelectLayout.setHorizontalGroup(
            jPanelTypeSelectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelTypeSelectLayout.createSequentialGroup()
                .addGroup(jPanelTypeSelectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelTypeSelectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jRadioButtonHighpass, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jRadioButtonBandpass, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jRadioButtonLowpass, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jRadioButtonBandstop))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanelTypeSelectLayout.setVerticalGroup(
            jPanelTypeSelectLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelTypeSelectLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jRadioButtonLowpass)
                .addGap(18, 18, 18)
                .addComponent(jRadioButtonHighpass)
                .addGap(18, 18, 18)
                .addComponent(jRadioButtonBandpass, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jRadioButtonBandstop)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanelLowpass.setBorder(javax.swing.BorderFactory.createTitledBorder("Lowpass specifications"));
        jPanelLowpass.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jPanelLowpass.setPreferredSize(new java.awt.Dimension(450, 250));

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel1.setText("Wp = ");

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel2.setText("Ws = ");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel3.setText("Rp = ");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel4.setText("As = ");

        jTextFieldLowpassWp.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldLowpassWp.setText("0.2");

        jTextFieldLowpassWs.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldLowpassWs.setText("0.3");

        jTextFieldLowpassRp.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldLowpassRp.setText("0.25");

        jTextFieldLowpassAs.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldLowpassAs.setText("50");
        jTextFieldLowpassAs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldLowpassAsActionPerformed(evt);
            }
        });
        jTextFieldLowpassAs.addInputMethodListener(new java.awt.event.InputMethodListener() {
            public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
            }
            public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
                jTextFieldLowpassAsInputMethodTextChanged(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel5.setText("*Pi");

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel6.setText("*Pi");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel7.setText("dB");

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel8.setText("dB");

        jLabelLowpassM.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelLowpassM.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabelLowpassM.setText("M =");

        jTextFieldLowpassM.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldLowpassM.setText("20");

        jLabelLowpassT1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelLowpassT1.setText("T1 =");

        jTextFieldLowpassT1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldLowpassT1.setText("0.5");

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel19.setText("Passband edge");

        jLabel52.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel52.setText("Stopband edge");

        jLabelLowpassT2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelLowpassT2.setText("T2 =");

        jTextFieldLowpassT2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldLowpassT2.setText("0");

        javax.swing.GroupLayout jPanelLowpassLayout = new javax.swing.GroupLayout(jPanelLowpass);
        jPanelLowpass.setLayout(jPanelLowpassLayout);
        jPanelLowpassLayout.setHorizontalGroup(
            jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelLowpassLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(jPanelLowpassLayout.createSequentialGroup()
                        .addComponent(jLabelLowpassM, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldLowpassM, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel19, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)
                    .addComponent(jLabel52, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(51, 51, 51)
                .addGroup(jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelLowpassLayout.createSequentialGroup()
                        .addGroup(jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanelLowpassLayout.createSequentialGroup()
                                .addGap(6, 6, 6)
                                .addComponent(jLabelLowpassT1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldLowpassT1))
                            .addGroup(jPanelLowpassLayout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jLabel5))
                            .addGroup(jPanelLowpassLayout.createSequentialGroup()
                                .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldLowpassWs, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel6)))
                        .addGap(41, 41, 41))
                    .addGroup(jPanelLowpassLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldLowpassWp, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(6, 6, 6)))
                .addGroup(jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanelLowpassLayout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldLowpassRp, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel7))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelLowpassLayout.createSequentialGroup()
                        .addGroup(jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(jPanelLowpassLayout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jLabelLowpassT2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextFieldLowpassT2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanelLowpassLayout.createSequentialGroup()
                                .addComponent(jTextFieldLowpassAs, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel8)))))
                .addGap(25, 25, 25))
        );
        jPanelLowpassLayout.setVerticalGroup(
            jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelLowpassLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(jLabel1)
                    .addComponent(jTextFieldLowpassWp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel3)
                    .addComponent(jTextFieldLowpassRp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addGap(34, 34, 34)
                .addGroup(jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel8)
                        .addComponent(jTextFieldLowpassAs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4)
                        .addComponent(jLabel6)
                        .addComponent(jTextFieldLowpassWs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2))
                    .addComponent(jLabel52))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 65, Short.MAX_VALUE)
                .addGroup(jPanelLowpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldLowpassT2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelLowpassT2)
                    .addComponent(jTextFieldLowpassT1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelLowpassT1)
                    .addComponent(jTextFieldLowpassM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelLowpassM))
                .addGap(51, 51, 51))
        );

        jPanelHighpass.setBorder(javax.swing.BorderFactory.createTitledBorder("Highpass specifications"));
        jPanelHighpass.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jPanelHighpass.setPreferredSize(new java.awt.Dimension(450, 250));

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel9.setText("Stopband edge");

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel10.setText("Ws = ");

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel11.setText("As = ");

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel12.setText("Passband edge");

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel13.setText("Wp = ");

        jLabel14.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel14.setText("Rp = ");

        jTextFieldHighpassWs.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldHighpassWs.setText("0.6");

        jTextFieldHighpassAs.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldHighpassAs.setText("60");

        jTextFieldHighpassWp.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldHighpassWp.setText("0.8");

        jTextFieldHighpassRp.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldHighpassRp.setText("0.5");

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel15.setText("*Pi");

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel16.setText("dB");

        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel17.setText("*Pi");

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel18.setText("dB");

        jLabelHighpassM.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelHighpassM.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabelHighpassM.setText("M =");

        jTextFieldHighpassM.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldHighpassM.setText("33");

        jLabelHighpassT1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelHighpassT1.setText("T1 =");

        jTextFieldHighpassT1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldHighpassT1.setText("0.1095");

        jLabelHighpassT2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelHighpassT2.setText("T2 =");

        jTextFieldHighpassT2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldHighpassT2.setText("0.598");

        javax.swing.GroupLayout jPanelHighpassLayout = new javax.swing.GroupLayout(jPanelHighpass);
        jPanelHighpass.setLayout(jPanelHighpassLayout);
        jPanelHighpassLayout.setHorizontalGroup(
            jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelHighpassLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
                    .addGroup(jPanelHighpassLayout.createSequentialGroup()
                        .addComponent(jLabelHighpassM, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldHighpassM, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelHighpassLayout.createSequentialGroup()
                        .addGap(49, 49, 49)
                        .addComponent(jLabel10))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelHighpassLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelHighpassT1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelHighpassLayout.createSequentialGroup()
                        .addGroup(jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelHighpassLayout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(jTextFieldHighpassWs, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel15)
                                .addGap(63, 63, 63))
                            .addGroup(jPanelHighpassLayout.createSequentialGroup()
                                .addComponent(jTextFieldHighpassWp, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel17)
                                .addGap(60, 60, 60)))
                        .addGroup(jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelHighpassLayout.createSequentialGroup()
                                .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldHighpassAs, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanelHighpassLayout.createSequentialGroup()
                                .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextFieldHighpassRp, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel18)
                            .addComponent(jLabel16)))
                    .addGroup(jPanelHighpassLayout.createSequentialGroup()
                        .addComponent(jTextFieldHighpassT1, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabelHighpassT2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldHighpassT2, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(260, 260, 260))
        );
        jPanelHighpassLayout.setVerticalGroup(
            jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelHighpassLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jLabel10)
                    .addComponent(jTextFieldHighpassWs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15)
                    .addComponent(jTextFieldHighpassAs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel16)
                    .addComponent(jLabel11))
                .addGap(30, 30, 30)
                .addGroup(jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addComponent(jTextFieldHighpassWp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17)
                    .addComponent(jLabel14)
                    .addComponent(jTextFieldHighpassRp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 72, Short.MAX_VALUE)
                .addGroup(jPanelHighpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldHighpassT2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelHighpassT2)
                    .addComponent(jTextFieldHighpassT1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelHighpassT1)
                    .addComponent(jTextFieldHighpassM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelHighpassM))
                .addGap(48, 48, 48))
        );

        jPanelBandpass.setBorder(javax.swing.BorderFactory.createTitledBorder("Bandpass specifications"));
        jPanelBandpass.setPreferredSize(new java.awt.Dimension(450, 250));

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel20.setText("Lower stopband edge");

        jTextFieldBandpassW1s.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandpassW1s.setText("0.2");

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel21.setText("*Pi");

        jLabel22.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel22.setText("As = ");

        jTextFieldBandpassAs.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandpassAs.setText("60");

        jLabel23.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel23.setText("dB");

        jLabel24.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel24.setText("Lower passband edge");

        jTextFieldBandpassW1p.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandpassW1p.setText("0.35");

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel25.setText("*Pi");

        jLabel26.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel26.setText("Rp = ");

        jTextFieldBandpassRp.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandpassRp.setText("1");

        jLabel27.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel27.setText("dB");

        jLabel28.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel28.setText("Upper passband edge");

        jTextFieldBandpassW2p.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandpassW2p.setText("0.65");

        jLabel29.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel29.setText("W2p = ");

        jLabel30.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel30.setText("*Pi");

        jLabel32.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel32.setText("Upper stopband edge");

        jTextFieldBandpassW2s.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandpassW2s.setText("0.8");

        jLabel33.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel33.setText("*Pi");

        jLabel34.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel34.setText("W2s = ");

        jLabel36.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel36.setText("W1s = ");

        jLabel37.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel37.setText("W1p = ");

        jLabelBandpassM.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelBandpassM.setText("M =");

        jTextFieldBandpassM.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandpassM.setText("40");

        jLabelBandpassT1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelBandpassT1.setText("T1 =");

        jTextFieldBandpassT1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandpassT1.setText("0.109021");

        jLabelBandpassT2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelBandpassT2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabelBandpassT2.setText("T2 = ");

        jTextFieldBandpassT2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandpassT2.setText("0.59417456");

        javax.swing.GroupLayout jPanelBandpassLayout = new javax.swing.GroupLayout(jPanelBandpass);
        jPanelBandpass.setLayout(jPanelBandpassLayout);
        jPanelBandpassLayout.setHorizontalGroup(
            jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelBandpassLayout.createSequentialGroup()
                .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBandpassLayout.createSequentialGroup()
                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelBandpassLayout.createSequentialGroup()
                                .addContainerGap()
                                .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel32, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel28, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE))
                                .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanelBandpassLayout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel29))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelBandpassLayout.createSequentialGroup()
                                        .addGap(11, 11, 11)
                                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelBandpassLayout.createSequentialGroup()
                                                .addComponent(jLabelBandpassT1)
                                                .addGap(14, 14, 14))
                                            .addComponent(jLabel34, javax.swing.GroupLayout.Alignment.TRAILING)))))
                            .addGroup(jPanelBandpassLayout.createSequentialGroup()
                                .addGap(31, 31, 31)
                                .addComponent(jLabelBandpassM)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jTextFieldBandpassM, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldBandpassT1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanelBandpassLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel24, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel36)
                            .addComponent(jLabel37))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelBandpassLayout.createSequentialGroup()
                                .addComponent(jTextFieldBandpassW2s, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel33))
                            .addGroup(jPanelBandpassLayout.createSequentialGroup()
                                .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jTextFieldBandpassW1s, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
                                    .addComponent(jTextFieldBandpassW1p)
                                    .addComponent(jTextFieldBandpassW2p))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel25, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBandpassLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jLabelBandpassT2, javax.swing.GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldBandpassT2, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(jPanelBandpassLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel26, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelBandpassLayout.createSequentialGroup()
                                .addComponent(jTextFieldBandpassAs, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel23))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelBandpassLayout.createSequentialGroup()
                                .addComponent(jTextFieldBandpassRp, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel27)))
                        .addGap(30, 30, 30))))
        );
        jPanelBandpassLayout.setVerticalGroup(
            jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelBandpassLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel22)
                        .addComponent(jTextFieldBandpassAs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel23))
                    .addGroup(jPanelBandpassLayout.createSequentialGroup()
                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextFieldBandpassW1s)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel36)
                                .addComponent(jLabel21)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel26)
                                .addComponent(jTextFieldBandpassRp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel27))
                            .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel37)
                                .addComponent(jTextFieldBandpassW1p, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel25)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jTextFieldBandpassW2p, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel29)
                                .addComponent(jLabel30))
                            .addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelBandpassLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel34)
                                    .addComponent(jTextFieldBandpassW2s, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel33)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelBandpassLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
                .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabelBandpassM)
                        .addComponent(jTextFieldBandpassM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanelBandpassLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabelBandpassT1)
                        .addComponent(jTextFieldBandpassT1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabelBandpassT2)
                        .addComponent(jTextFieldBandpassT2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(49, 49, 49))
        );

        jButton1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jButton1.setText("Draw");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanelBandstop.setBorder(javax.swing.BorderFactory.createTitledBorder("Bandstop specifications"));
        jPanelBandstop.setPreferredSize(new java.awt.Dimension(450, 250));

        jLabel31.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel31.setText("Lower stopband edge");

        jTextFieldBandstopW1s.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandstopW1s.setText("0.35");

        jLabel35.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel35.setText("*Pi");

        jLabel38.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel38.setText("As = ");

        jTextFieldBandstopAs.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandstopAs.setText("40");

        jLabel39.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel39.setText("dB");

        jLabel40.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel40.setText("Upper stopband edge");

        jTextFieldBandstopW2s.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandstopW2s.setText("0.65");

        jLabel41.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel41.setText("*Pi");

        jLabel42.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel42.setText("Rp = ");

        jTextFieldBandstopRp.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandstopRp.setText("0.5");

        jLabel43.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel43.setText("dB");

        jLabel44.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel44.setText("Lower passband edge");

        jTextFieldBandstopW1p.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandstopW1p.setText("0.2");

        jLabel45.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel45.setText("W1p = ");

        jLabel46.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel46.setText("*Pi");

        jLabel47.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel47.setText("Upper passband edge");

        jTextFieldBandstopW2p.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandstopW2p.setText("0.8");

        jLabel48.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel48.setText("*Pi");

        jLabel49.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel49.setText("W2p = ");

        jLabel50.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel50.setText("W1s = ");

        jLabel51.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel51.setText("W2s = ");

        jLabelBandstopM.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelBandstopM.setText("M =");

        jTextFieldBandstopM.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandstopM.setText("40");

        jLabelBandstopT1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelBandstopT1.setText("  T1 =");

        jTextFieldBandstopT1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandstopT1.setText("0");

        jLabelBandstopT2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabelBandstopT2.setText("T2 =");

        jTextFieldBandstopT2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jTextFieldBandstopT2.setText("0");
        jTextFieldBandstopT2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldBandstopT2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelBandstopLayout = new javax.swing.GroupLayout(jPanelBandstop);
        jPanelBandstop.setLayout(jPanelBandstopLayout);
        jPanelBandstopLayout.setHorizontalGroup(
            jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelBandstopLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel44)
                    .addComponent(jLabel40)
                    .addComponent(jLabel47)
                    .addComponent(jLabel31)
                    .addGroup(jPanelBandstopLayout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addComponent(jLabelBandstopM)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldBandstopM, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel49, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel45))
                        .addComponent(jLabel51, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addGroup(jPanelBandstopLayout.createSequentialGroup()
                        .addGap(1, 1, 1)
                        .addComponent(jLabel50))
                    .addComponent(jLabelBandstopT1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 8, Short.MAX_VALUE)
                .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanelBandstopLayout.createSequentialGroup()
                        .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelBandstopLayout.createSequentialGroup()
                                .addComponent(jTextFieldBandstopW2p, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel48))
                            .addComponent(jTextFieldBandstopT1, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(32, 32, 32)
                        .addComponent(jLabelBandstopT2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldBandstopT2, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(9, 9, 9))
                    .addGroup(jPanelBandstopLayout.createSequentialGroup()
                        .addComponent(jTextFieldBandstopW1p, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel46))
                    .addGroup(jPanelBandstopLayout.createSequentialGroup()
                        .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextFieldBandstopW1s, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldBandstopW2s, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanelBandstopLayout.createSequentialGroup()
                                .addComponent(jLabel35)
                                .addGap(33, 33, 33)
                                .addComponent(jLabel38))
                            .addGroup(jPanelBandstopLayout.createSequentialGroup()
                                .addComponent(jLabel41)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel42)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextFieldBandstopAs)
                            .addComponent(jTextFieldBandstopRp, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel43, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel39))))
                .addGap(29, 29, 29))
        );
        jPanelBandstopLayout.setVerticalGroup(
            jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelBandstopLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel50)
                    .addComponent(jTextFieldBandstopW1s, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel35)
                    .addComponent(jLabel38)
                    .addComponent(jTextFieldBandstopAs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel39))
                .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBandstopLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel43))
                    .addGroup(jPanelBandstopLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel40, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel51)
                            .addComponent(jTextFieldBandstopW2s, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel41)
                            .addComponent(jLabel42)
                            .addComponent(jTextFieldBandstopRp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBandstopLayout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addComponent(jLabel46))
                    .addGroup(jPanelBandstopLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel44, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel45)
                                .addComponent(jTextFieldBandstopW1p, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldBandstopW2p, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel48)
                        .addComponent(jLabel49))
                    .addComponent(jLabel47, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanelBandstopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldBandstopT1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldBandstopT2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelBandstopT2)
                    .addComponent(jLabelBandstopT1)
                    .addComponent(jTextFieldBandstopM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelBandstopM))
                .addGap(84, 84, 84))
        );

        jLabel53.setFont(new java.awt.Font("Courier New", 1, 20)); // NOI18N
        jLabel53.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel53.setText("FINITE IMPULSE RESPONSE DESIGN");

        jButton2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jButton2.setText("Print");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel53, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jPanelTypeSelect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanelDesign, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jPanelLowpass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(10, 10, 10)
                                .addComponent(jPanelHighpass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanelBandstop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanelBandpass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 384, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(jLabel53, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 53, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(59, 59, 59))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jPanelTypeSelect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanelDesign, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGap(22, 22, 22)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanelLowpass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanelHighpass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanelBandstop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanelBandpass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(24, 24, 24))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jRadioButtonFrequenceItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jRadioButtonFrequenceItemStateChanged
        if (jRadioButtonFrequence.isSelected()) {
            jComboBoxFrequence.setVisible(true);
            jComboBoxWindow.setVisible(false);
            setVisibleM(true);
            setVisibleT(false);
        }
    }//GEN-LAST:event_jRadioButtonFrequenceItemStateChanged

    private void jRadioButtonWindowItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jRadioButtonWindowItemStateChanged
        if (jRadioButtonWindow.isSelected()) {
            jComboBoxFrequence.setVisible(false);
            jComboBoxWindow.setVisible(true);
            setVisibleM(false);
            setVisibleT(false);
        }
    }//GEN-LAST:event_jRadioButtonWindowItemStateChanged

    private void jRadioButtonOptimalItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jRadioButtonOptimalItemStateChanged
        if (jRadioButtonOptimal.isSelected()) {
            jComboBoxFrequence.setVisible(false);
            jComboBoxWindow.setVisible(false);
            setVisibleM(false);
            setVisibleT(false);
        }
    }//GEN-LAST:event_jRadioButtonOptimalItemStateChanged

    private void jRadioButtonHighpassItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jRadioButtonHighpassItemStateChanged
    }//GEN-LAST:event_jRadioButtonHighpassItemStateChanged

    private void jRadioButtonLowpassItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jRadioButtonLowpassItemStateChanged
    }//GEN-LAST:event_jRadioButtonLowpassItemStateChanged

    private void jRadioButtonBandpassItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jRadioButtonBandpassItemStateChanged
    }//GEN-LAST:event_jRadioButtonBandpassItemStateChanged

    private void jRadioButtonLowpassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonLowpassActionPerformed
        if (jRadioButtonLowpass.isSelected()) {

            jPanelLowpass.setVisible(true);
            jPanelBandpass.setVisible(false);
            jPanelHighpass.setVisible(false);
            jPanelBandstop.setVisible(false);
        }
    }//GEN-LAST:event_jRadioButtonLowpassActionPerformed

    private void jRadioButtonHighpassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonHighpassActionPerformed
        if (jRadioButtonHighpass.isSelected()) {

            jPanelLowpass.setVisible(false);
            jPanelBandpass.setVisible(false);
            jPanelHighpass.setVisible(true);
            jPanelBandstop.setVisible(false);
        }
    }//GEN-LAST:event_jRadioButtonHighpassActionPerformed

    private void jRadioButtonBandpassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonBandpassActionPerformed
        if (jRadioButtonBandpass.isSelected()) {
            jPanelLowpass.setVisible(false);
            jPanelBandpass.setVisible(true);
            jPanelHighpass.setVisible(false);
            jPanelBandstop.setVisible(false);
        }
    }//GEN-LAST:event_jRadioButtonBandpassActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

        int windowType = 0;
        switch (jComboBoxWindow.getSelectedItem().toString()) {
            case "Rectangular":
                windowType = RECTANGLE;
                break;
            case "Bartlett":
                windowType = BARTLETT;
                break;
            case "Hanning":
                windowType = HANNING;
                break;
            case "Hamming":
                windowType = HAMMING;
                break;
            case "Blackman":
                windowType = BLACKMAN;
                break;
            case "Kaiser":
                windowType = KAISER;
                break;
        }
        int frequenceType = jComboBoxFrequence.getSelectedIndex();
        if (jRadioButtonLowpass.isSelected()) {
            double wp = Double.parseDouble(jTextFieldLowpassWp.getText());
            double ws = Double.parseDouble(jTextFieldLowpassWs.getText());
            double Rp = Double.parseDouble(jTextFieldLowpassRp.getText());
            double As = Double.parseDouble(jTextFieldLowpassAs.getText());
            if (jRadioButtonWindow.isSelected()) {
                fIRWindow = new FIRWindow(LOW_PASS, windowType, wp, ws, As, Rp);
            } else if (jRadioButtonFrequence.isSelected()) {
                int M = Integer.parseInt(jTextFieldLowpassM.getText());
                double T1;
                double T2;
                if (jComboBoxFrequence.getSelectedIndex() == 0) {
                    T1 = 0;
                    T2 = 0;
                } else {
                 T1 = Double.parseDouble(jTextFieldLowpassT1.getText());
                 T2 = Double.parseDouble(jTextFieldLowpassT2.getText());
                }

                fIRFrequenceSample = new FIRFrequenceSample(LOW_PASS, frequenceType, M, wp, ws, As, Rp, T1, T2);
            } else if (jRadioButtonOptimal.isSelected()) {
                fIROptimalEquiripple = new FIROptimalEquiripple(LOW_PASS, wp, ws, As, Rp);
            }
        } else if (jRadioButtonHighpass.isSelected()) {
            double wp = Double.parseDouble(jTextFieldHighpassWp.getText());
            double ws = Double.parseDouble(jTextFieldHighpassWs.getText());
            double Rp = Double.parseDouble(jTextFieldHighpassRp.getText());
            double As = Double.parseDouble(jTextFieldHighpassAs.getText());
            if (jRadioButtonWindow.isSelected()) {
                fIRWindow = new FIRWindow(HIGH_PASS, windowType, wp, ws, As, Rp);
            } else if (jRadioButtonFrequence.isSelected()) {
                int M = Integer.parseInt(jTextFieldHighpassM.getText());
                double T1 = Double.parseDouble(jTextFieldHighpassT1.getText());
                double T2 = Double.parseDouble(jTextFieldHighpassT2.getText());
                fIRFrequenceSample = new FIRFrequenceSample(HIGH_PASS, frequenceType, M, wp, ws, As, Rp, T1, T2);
            } else if (jRadioButtonOptimal.isSelected()) {
                fIROptimalEquiripple = new FIROptimalEquiripple(HIGH_PASS, wp, ws, As, Rp);
            }
        } else if (jRadioButtonBandpass.isSelected()) {
            double wp = Double.parseDouble(jTextFieldBandpassW1p.getText());
            double ws = Double.parseDouble(jTextFieldBandpassW1s.getText());
            double Rp = Double.parseDouble(jTextFieldBandpassRp.getText());
            double As = Double.parseDouble(jTextFieldBandpassAs.getText());
            double w2p = Double.parseDouble(jTextFieldBandpassW2p.getText());
            double w2s = Double.parseDouble(jTextFieldBandpassW2s.getText());
            if (jRadioButtonWindow.isSelected()) {
                fIRWindow = new FIRWindow(BAND_PASS, windowType, wp, ws, As, Rp, w2p, w2s);
            } else if (jRadioButtonFrequence.isSelected()) {
                int M = Integer.parseInt(jTextFieldBandpassM.getText());
                double T1 = Double.parseDouble(jTextFieldBandpassT1.getText());
                double T2 = Double.parseDouble(jTextFieldBandpassT2.getText());
                fIRFrequenceSample = new FIRFrequenceSample(BAND_PASS, frequenceType, M, wp, ws, As, Rp, w2p, w2s, T1, T2);
            } else if (jRadioButtonOptimal.isSelected()) {
                fIROptimalEquiripple = new FIROptimalEquiripple(BAND_PASS, wp, ws, As, Rp, w2p, w2s);
            }
        } else if (jRadioButtonBandstop.isSelected()) {
            double wp = Double.parseDouble(jTextFieldBandstopW1p.getText());
            double ws = Double.parseDouble(jTextFieldBandstopW1s.getText());
            double Rp = Double.parseDouble(jTextFieldBandstopRp.getText());
            double As = Double.parseDouble(jTextFieldBandstopAs.getText());
            double w2p = Double.parseDouble(jTextFieldBandstopW2p.getText());
            double w2s = Double.parseDouble(jTextFieldBandstopW2s.getText());
            if (jRadioButtonWindow.isSelected()) {
                fIRWindow = new FIRWindow(BAND_STOP, windowType, wp, ws, As, Rp, w2p, w2s);
            } else if (jRadioButtonFrequence.isSelected()) {
                int M = Integer.parseInt(jTextFieldBandstopM.getText());
                double T1 = Double.parseDouble(jTextFieldBandstopT1.getText());
                double T2 = Double.parseDouble(jTextFieldBandstopT2.getText());
                fIRFrequenceSample = new FIRFrequenceSample(BAND_STOP, frequenceType, M, wp, ws, As, Rp, w2p, w2s, T1, T2);
            } else if (jRadioButtonOptimal.isSelected()) {
                fIROptimalEquiripple = new FIROptimalEquiripple(BAND_STOP, wp, ws, As, Rp, w2p, w2s);
            }
        }
        if (jRadioButtonWindow.isSelected()) {
            drawWindow();
        } else if (jRadioButtonFrequence.isSelected()) {
            drawFrequence();
        } else {
            drawOptimal();
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    public void drawWindow() {
        if (windowFrame == null) {
            windowFrame = new WindowFrame(fIRWindow);
        } else {
            windowFrame.setData(fIRWindow);
            windowFrame.setVisible(true);
            windowFrame.repaint();
        }
    }

    public void drawFrequence() {
        if (frequenceFrame == null) {
            frequenceFrame = new FrequenceFrame(fIRFrequenceSample);
        } else {
            frequenceFrame.setData( fIRFrequenceSample);
            frequenceFrame.setVisible(true);
            frequenceFrame.repaint();
        }
    }

    public void drawOptimal() {
        if (optimalEquirippleFrame == null) {
            optimalEquirippleFrame = new OptimalEquirippleFrame(fIROptimalEquiripple);
        } else {
            optimalEquirippleFrame.setData(fIROptimalEquiripple);
            optimalEquirippleFrame.setVisible(true);
            optimalEquirippleFrame.repaint();
        }
    }

    public void resetCombobox() {
        int r = 0;
        int as = 0;
        if (jRadioButtonLowpass.isSelected()) {
            as = Integer.parseInt(jTextFieldLowpassAs.getText());
        } else if (jRadioButtonHighpass.isSelected()) {
            as = Integer.parseInt(jTextFieldHighpassAs.getText());
        } else if (jRadioButtonBandpass.isSelected()) {
            as = Integer.parseInt(jTextFieldBandpassAs.getText());
        } else if (jRadioButtonBandstop.isSelected()) {
            as = Integer.parseInt(jTextFieldBandstopAs.getText());
        }

        if (as > 74) {
            jComboBoxWindow.setModel(new DefaultComboBoxModel(ar7x));
        } else if (as > 53) {
            jComboBoxWindow.setModel(new DefaultComboBoxModel(ar74));
        } else if (as > 44) {
            jComboBoxWindow.setModel(new DefaultComboBoxModel(ar53));
        } else if (as > 25) {
            jComboBoxWindow.setModel(new DefaultComboBoxModel(ar44));
        } else if (as > 21) {
            jComboBoxWindow.setModel(new DefaultComboBoxModel(ar25));
        } else {
            jComboBoxWindow.setModel(new DefaultComboBoxModel(ar21));
        }
    }
    private void jTextFieldLowpassAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldLowpassAsActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldLowpassAsActionPerformed

    private void jComboBoxWindowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxWindowActionPerformed
    }//GEN-LAST:event_jComboBoxWindowActionPerformed

    private void jComboBoxWindowKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jComboBoxWindowKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBoxWindowKeyPressed

    private void jComboBoxWindowMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxWindowMousePressed
        resetCombobox();
    }//GEN-LAST:event_jComboBoxWindowMousePressed

    private void jTextFieldLowpassAsInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_jTextFieldLowpassAsInputMethodTextChanged
    }//GEN-LAST:event_jTextFieldLowpassAsInputMethodTextChanged

    private void jRadioButtonBandstopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonBandstopActionPerformed
        if (jRadioButtonBandstop.isSelected()) {
            jPanelBandstop.setVisible(true);
            jPanelLowpass.setVisible(false);
            jPanelBandpass.setVisible(false);
            jPanelHighpass.setVisible(false);
        }
    }//GEN-LAST:event_jRadioButtonBandstopActionPerformed

    private void jTextFieldBandstopT2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldBandstopT2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldBandstopT2ActionPerformed

    private void jComboBoxFrequenceMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jComboBoxFrequenceMousePressed
    }//GEN-LAST:event_jComboBoxFrequenceMousePressed

    private void jComboBoxFrequenceItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxFrequenceItemStateChanged

        if (jComboBoxFrequence.getSelectedIndex() == 0) {
            setVisibleT(false);
        } else {
            setVisibleT(true);
        }
    }//GEN-LAST:event_jComboBoxFrequenceItemStateChanged

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        String fileName;
        if (jRadioButtonWindow.isSelected()) {
            fileName = "D://FIR Window.txt";
        } else if (jRadioButtonFrequence.isSelected()) {
            fileName = "D://FIR Frequence Sample.txt";
        } else {
            fileName = "D://FIR Optimal Equiripple.txt";
        }
        File f = new File(fileName);
        Desktop dt = Desktop.getDesktop();
        try {
            dt.open(f);
        } catch (IOException ex) {
            Logger.getLogger(FIRPanel.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButton2ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroupFIRType;
    private javax.swing.ButtonGroup buttonGroupWindowMethod;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JComboBox jComboBoxFrequence;
    private javax.swing.JComboBox jComboBoxWindow;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    private javax.swing.JLabel jLabel39;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel40;
    private javax.swing.JLabel jLabel41;
    private javax.swing.JLabel jLabel42;
    private javax.swing.JLabel jLabel43;
    private javax.swing.JLabel jLabel44;
    private javax.swing.JLabel jLabel45;
    private javax.swing.JLabel jLabel46;
    private javax.swing.JLabel jLabel47;
    private javax.swing.JLabel jLabel48;
    private javax.swing.JLabel jLabel49;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel50;
    private javax.swing.JLabel jLabel51;
    private javax.swing.JLabel jLabel52;
    private javax.swing.JLabel jLabel53;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelBandpassM;
    private javax.swing.JLabel jLabelBandpassT1;
    private javax.swing.JLabel jLabelBandpassT2;
    private javax.swing.JLabel jLabelBandstopM;
    private javax.swing.JLabel jLabelBandstopT1;
    private javax.swing.JLabel jLabelBandstopT2;
    private javax.swing.JLabel jLabelHighpassM;
    private javax.swing.JLabel jLabelHighpassT1;
    private javax.swing.JLabel jLabelHighpassT2;
    private javax.swing.JLabel jLabelLowpassM;
    private javax.swing.JLabel jLabelLowpassT1;
    private javax.swing.JLabel jLabelLowpassT2;
    private javax.swing.JPanel jPanelBandpass;
    private javax.swing.JPanel jPanelBandstop;
    private javax.swing.JPanel jPanelDesign;
    public javax.swing.JPanel jPanelHighpass;
    private javax.swing.JPanel jPanelLowpass;
    private javax.swing.JPanel jPanelTypeSelect;
    private javax.swing.JRadioButton jRadioButtonBandpass;
    private javax.swing.JRadioButton jRadioButtonBandstop;
    private javax.swing.JRadioButton jRadioButtonFrequence;
    private javax.swing.JRadioButton jRadioButtonHighpass;
    private javax.swing.JRadioButton jRadioButtonLowpass;
    private javax.swing.JRadioButton jRadioButtonOptimal;
    private javax.swing.JRadioButton jRadioButtonWindow;
    private javax.swing.JTextField jTextFieldBandpassAs;
    private javax.swing.JTextField jTextFieldBandpassM;
    private javax.swing.JTextField jTextFieldBandpassRp;
    private javax.swing.JTextField jTextFieldBandpassT1;
    private javax.swing.JTextField jTextFieldBandpassT2;
    private javax.swing.JTextField jTextFieldBandpassW1p;
    private javax.swing.JTextField jTextFieldBandpassW1s;
    private javax.swing.JTextField jTextFieldBandpassW2p;
    private javax.swing.JTextField jTextFieldBandpassW2s;
    private javax.swing.JTextField jTextFieldBandstopAs;
    private javax.swing.JTextField jTextFieldBandstopM;
    private javax.swing.JTextField jTextFieldBandstopRp;
    private javax.swing.JTextField jTextFieldBandstopT1;
    private javax.swing.JTextField jTextFieldBandstopT2;
    private javax.swing.JTextField jTextFieldBandstopW1p;
    private javax.swing.JTextField jTextFieldBandstopW1s;
    private javax.swing.JTextField jTextFieldBandstopW2p;
    private javax.swing.JTextField jTextFieldBandstopW2s;
    private javax.swing.JTextField jTextFieldHighpassAs;
    private javax.swing.JTextField jTextFieldHighpassM;
    private javax.swing.JTextField jTextFieldHighpassRp;
    private javax.swing.JTextField jTextFieldHighpassT1;
    private javax.swing.JTextField jTextFieldHighpassT2;
    private javax.swing.JTextField jTextFieldHighpassWp;
    private javax.swing.JTextField jTextFieldHighpassWs;
    private javax.swing.JTextField jTextFieldLowpassAs;
    private javax.swing.JTextField jTextFieldLowpassM;
    private javax.swing.JTextField jTextFieldLowpassRp;
    private javax.swing.JTextField jTextFieldLowpassT1;
    private javax.swing.JTextField jTextFieldLowpassT2;
    private javax.swing.JTextField jTextFieldLowpassWp;
    private javax.swing.JTextField jTextFieldLowpassWs;
    // End of variables declaration//GEN-END:variables
}
